<?php
/**
 * 分类模型
 * 
 * @version $Id: Classes.php 647 2013-01-23 06:39:11Z linsir123 $
 */
class adminClasses 
{
	/**
	 * @var 模型
	 */
	public $dbClass;
	
	/**
	 * 构造函数
	 */
	public function __construct()
	{
		App::V('pinyin');
		///
		$this->dbClass = D::classes();
	}
	
	/**
	 * 保存
	 */
	public function save($parentId, $classId, $title)
	{
		$pinyin = string2pinyin($title);
		///
		return $this->dbClass->save($parentId, $pinyin, $classId, $title);
	}
	
	/**
	 * 
	 */
	public function getTopSub($classId)
	{
		$data = array();
		$tmp = M::topRequest()->itemcatsGet(null, $classId);
		foreach ($tmp as $v) 
			$data[$v['id']] = $v['title'];
			
		///
		return $data;
	}
}
